<extend name="common:commonTemplate"/>
<block name="main_content">
    <div id="content">
        <div id="content-header">
            <div id="breadcrumb">
                <a class="tip-bottom" href="index.html"
                   data-original-title="Go to Home"><i class="icon-home"></i> 首页</a> <a
                    href="#">商品</a> <a class="current" href="#">新增商品促销信息</a>
            </div>
        </div>
        <div class="container-fluid">
            <div class="row-fluid">
                <div class="span12">
                    <div class="widget-box">
                        <div class="widget-title">
						<span class="icon"> <i class="icon-info-sign"></i>
						</span>
                            <h5>新增商品促销信息</h5>
                        </div>
                        <div class="widget-content nopadding">
                            <form novalidate="novalidate" id="basic_validate"
                                  name="basic_validate" action="#" method="post"
                                  class="form-horizontal">
                                <div class="control-group">
                                    <label class="control-label">促销名称</label>
                                    <div class="controls">
                                        <input type="hidden" name="promotion_id" value="{$promotion.promotion_id}">
                                        <input type="text" id="promotion_name" name="promotion_name" value="{$promotion.promotion_name}"/>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">促销描述</label>
                                    <div class="controls">
                                        <input type="text" id="promotion_desc" name="promotion_desc" value="{$promotion.promotion_desc}">
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">促销类型</label>
                                    <div class="controls">
                                        <select id="promotion_type" name="promotion_type" style="width:220px;">
                                                <option value="1" selected>满减</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">促销渠道</label>
                                    <div class="controls">
                                    	<select id="promotion_channel" name="promotion_channel" style="width:220px;">
                                                <option value="5" selected>英雄会</option>
                                        </select>
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">条件数量</label>
                                    <div class="controls">
                                        <input type="text" id="condition_count" name="condition_count" value="{$promotion.condition_count}">
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">条件金额</label>
                                    <div class="controls">
                                        <input type="text" id="condition_amount" name="condition_amount" value="{$promotion.condition_amount}">
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">折扣金额</label>
                                    <div class="controls">
                                        <input type="text" id="discount_amount" name="discount_amount" value="{$promotion.discount_amount}">
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">sku_id数据集合</label>
                                    <div class="controls">
                                        <input type="text" id="sku_id_list" name="sku_id_list" value="{$promotion.sku_id_list}">
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">状态</label>
                                    <div class="controls">
                                        <select id="status" name="status" style="width:220px;">

                                           	<option value="1" selected>有效</option>
                                               <option value="0">无效</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <a id="btn_addpromotion" class="btn btn-success">{$operate_name}</a>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</block>
<block name="js_content">
    <script>
        $('#btn_addpromotion').bind('click', function () {
            $.ajax({
                type: 'post',
                url: '/AjaxService/center/promotion/saveorupdate',
                data: $("#basic_validate").serialize(),
                dataType: 'json',
                async: false,
                success: function (data) {
                    if (data.IsSuccess == 0) {
                        alert(data.ErrorMsg);
                        return;
                    } else {
                        alert('操作成功');
                    }
                },
                error: function (e, err_name, err_text) {
                }
            });
        });

    </script>
</block>